package com.example.baweyplayer.abstracts;

import com.example.baweyplayer.activities.LibraryActivity;
import com.example.baweyplayer.activities.PlayerActivity;
import com.example.baweyplayer.activities.PlaylistsActivity;
import com.example.baweyplayer.activities.SettingsActivity;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;

public class AbstractFullscreenActivity extends Activity {

	protected final static int MENU_COLLECTION = 1;
	protected final static int MENU_PLAYING = 2;
	protected final static int MENU_PLAYLISTS = 3;
	protected final static int MENU_SETTINGS = 4;

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		menu.add(0, MENU_COLLECTION, 0, "Library");
		menu.add(0, MENU_PLAYING, 0, "Now Playing");
		menu.add(0, MENU_PLAYLISTS, 0, "Playlists");
		menu.add(0, MENU_SETTINGS, 0, "Settings");
		super.onCreateOptionsMenu(menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		Intent intent = null;
		Log.v("baweyLog", "options");
		switch (item.getItemId()) {
		case MENU_COLLECTION:
			intent = new Intent(this, LibraryActivity.class);
			break;
		case MENU_PLAYING:
			intent = new Intent(this, PlayerActivity.class);
			break;
		case MENU_PLAYLISTS:
			intent = new Intent(this, PlaylistsActivity.class);
			break;
		case MENU_SETTINGS:
			intent = new Intent(this, SettingsActivity.class);
			break;
		default:
			break;
		}
		if (intent != null) {
			startActivity(intent);
			return true;
		}
		return false;
	}

}
